package com.example.smart_campus.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.example.smart_campus.pojo.dto.students.StudentsTable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.relational.core.mapping.Table;

import java.io.Serializable;

/**
 * <p>
 * 学生表，存储学生的基本信息
 * </p>
 *
 * @author liyv
 * @since 2024-10-19
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table("students")
public class Students implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 学生ID，主键
     */
    @TableId(value = "student_id", type = IdType.AUTO)
    private Integer studentId;

    /**
     * 学生学号
     */
    private String studentNo;

    /**
     * 学生姓名
     */
    private String name;

    /**
     * 学生密码
     */

    private String password;

    /**
     * 学生年级
     */
    private String grade;

    /**
     * 学生专业
     */
    private String major;

    /**
     * 学生性别
     */
    private String gender;

    /**
     * 学生联系方式
     */
    private String contactInfo;


    @Override
    public String toString() {
        return "Students{" +
        "studentId=" + studentId +
        ", studentNo=" + studentNo +
        ", name=" + name +
        ", password=" + password +
        ", grade=" + grade +
        ", major=" + major +
        ", gender=" + gender +
        ", contactInfo=" + contactInfo +
        "}";
    }

    public Students(StudentsTable table) {
        this.studentNo = table.getStudentNo();
        this.name = table.getName();
        this.grade = table.getGrade();
        this.major = table.getMajor();
        this.password = "123456" ;
    }


}
